package com.service.hibernate.dao;

import java.util.ArrayList;
import java.util.List;

import com.service.hibernate.pojos.Vehicles;

public class VehicleDAO extends GenericDAO<Vehicles> {

	@SuppressWarnings("unchecked")
	public List<String> getVehicleIds() {
		
		List<Vehicles> vehicles = new ArrayList<Vehicles>();
		List<String> vehIds = new ArrayList<String>();
		Vehicles vehicle=new Vehicles();
		
		try {
			//vehicles = session.createQuery("FROM Vehicles").list();
			vehicles=super.getAllData("Vehicles");
			int count = 0;
			System.out
			.println("###############################################################################################################");
			while (count < vehicles.size()) {
				vehicle=(Vehicles)vehicles.get(count);
				System.out.println(vehicle.getVehRegNo().toString());
				vehIds.add(vehicle.getVehRegNo().toString());
				count++;
			}
			System.out
			.println("###############################################################################################################");
		} catch (Exception e) {
			System.out
					.println("----------------------------------------------------------------------------------------------------");
			System.out.println("Error in VehicleDAO - getVehicleIds Method :");
			e.printStackTrace();
			System.out
					.println("----------------------------------------------------------------------------------------------------");
		}
		return vehIds;
	}
}
